import { createRouter, createWebHistory } from 'vue-router'
import Layout from '@/views/common/layout.vue'
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      component: () => import('@/views/dashboard.vue')
    },
    {
      path: '/redirect',
      component: Layout,
      children: [
        {
          path: '/redirect/:path(.*)',
          component: () => import('@/views/common/redirect.vue')
        }
      ]
    },
    {
      path: '/login',
      name: 'login',
      component: import('@/views/login.vue')
    },
    {
      path: '/404',
      name: '404',
      component: import('@/views/404.vue')
    }
  ]
})


export const errorRoute = {
	path: '/:pathMatch(.*)',
	redirect: '/404'
}

// router.addRoute(errorRoute)

export default router
